package cloud.simple.rabbitmq;/**
 * Created by joyu on 2017/8/10.
 */


import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author joyu
 * @ClassName Sender
 * @Description 消息生产者
 * @create 2017年08月10日 13:42
 */
@Component
public class Sender {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send() {
        String context = "hello " + new Date();
        System.out.println("Sender: " + context);
        rabbitTemplate.convertAndSend("hello", context);
    }
}
